<?php

include "../dao/message_dao.php";
require_once "../dao/database.php";

$class_db = new Database;
$message = new Message_Dao($class_db);

if(isset($_POST['Submit'])){
	
	$sender = $_POST['sender'];
	$email = $_POST['email'];
	$subject = $_POST['subject'];
	$content = $_POST['content'];
	
	$value= array("$sender","$email","$subject","$content");
	$row = 'sender,email,subject,content';
	$add=$message->db->add('message',$value,$row);
	
	if($add){
            header('location:contact.php');
        }else{
            echo "gak berhasil kirim";
        }
		
}

?>